home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
005
/
miscstat.arc
/
CHSQDIST.BAS
< prev
next >
Wrap
BASIC Source File
|
1986-04-25
|
933b
|
36 lines
1 'CHi-SQuare DISTribution
2 KEY OFF:SCREEN 0,1,0:WIDTH 40:COLOR 15,1,9:CLS
10 PRINT "CHI-SQUARE DISTRIBUTION"
20 PRINT
30 PRINT "(TO END PROGRAM ENTER 0)"
40 PRINT "DEGREES OF FREEDOM";
50 INPUT V:V=ABS(V)
60 IF V = 0 THEN 280
70 PRINT "CHI-SQUARE";
80 INPUT W
90 R = 1
100 FOR I = V TO 2 STEP - 2
110 F = F * I
120 NEXT I
130 K = W ^ ( INT ((V + 1) / 2)) * EXP ( - W / 2) / R
140 IF INT (V / 2) = V / 2 THEN 180
150 J = SQR (2 / W / 3.1415927#)
160 GOTO 180
180 L = 1
190 M = 1
200 V = V + 2
210 M = M * W / V
220 IF M < .0000001 THEN 250
230 L = L + M
240 GOTO 200
250 PRINT:PRINT "TAIL END VALUE IS"1 - J * K * L
255 PRINT "PERCENTILE IS"J * K * L
260 PRINT
270 GOTO 40
280 PRINT:LOCATE 24,1:PRINT"PRESS <SPACE> TO RUN AGAIN";
290 LOCATE 25,1:PRINT"PRESS <ESC> TO EXIT";
300 K$=INKEY$:IF K$="" THEN 300
310 IF K$=" " THEN RUN
320 IF K$<>CHR$(27) THEN 300
10000 RUN"MENU